home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hal.postinst < prev    next >
Encoding:
Text File  |  2009-07-05  |  2.5 KB  |  84 lines

  1. #! /bin/sh
  2. # postinst script for hal
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <postinst> `configure' <most-recently-configured-version>
  10. #        * <old-postinst> `abort-upgrade' <new version>
  11. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  12. #          <new-version>
  13. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  14. #          <failed-install-package> <version> `removing'
  15. #          <conflicting-package> <version>
  16. # for details, see http://www.debian.org/doc/debian-policy/ or
  17. # the debian-policy package
  18. #
  19. # quoting from the policy:
  20. #     Any necessary prompting should almost always be confined to the
  21. #     post-installation script, and should be protected with a conditional
  22. #     so that unnecessary prompting doesn't happen if a package's
  23. #     installation fails and the `postinst' is called with `abort-upgrade',
  24. #     `abort-remove' or `abort-deconfigure'.
  25.  
  26. case "$1" in
  27.   configure)
  28.     getent passwd haldaemon >/dev/null || \
  29.     adduser --system \
  30.             --quiet  \
  31.             --disabled-password \
  32.             --no-create-home \
  33.             --home "/var/run/hald" \
  34.             --gecos "Hardware abstraction layer" \
  35.             --quiet \
  36.             --group haldaemon
  37.  
  38.     # Remove old stop symlinks on upgrades
  39.     if dpkg --compare-versions "$2" lt-nl "0.5.11-6"; then
  40.       rm -f /etc/rc[06].d/K??hal
  41.     fi
  42.  
  43.     if [ -x /etc/init.d/dbus ]; then
  44.       invoke-rc.d dbus force-reload || true
  45.     fi
  46.  
  47.     if [ -z "$2" ]; then
  48.         # Allow hal to query the PolicyKit database to enforce privileges
  49.         if ! /usr/bin/polkit-auth --user haldaemon --explicit | grep -q 'org.freedesktop.policykit.read'; then
  50.             /usr/bin/polkit-auth --user haldaemon --grant 'org.freedesktop.policykit.read'
  51.         fi
  52.     fi
  53.   ;;
  54.   abort-upgrade|abort-remove|abort-deconfigure)
  55.   ;;
  56.   triggered)
  57.     echo "Regenerating hal fdi cache ..."
  58.     rm -f /var/cache/hald/fdi-cache
  59.     invoke-rc.d hal restart || true
  60.     exit 0
  61.   ;;
  62.   *)
  63.     echo "postinst called with unknown argument \`$1'" >&2
  64.     exit 1
  65.   ;;
  66. esac
  67.  
  68. # dh_installdeb will replace this with shell code automatically
  69. # generated by other debhelper scripts.
  70.  
  71. # Automatically added by dh_installinit
  72. if [ -x "/etc/init.d/hal" ]; then
  73.     update-rc.d hal start 24 2 3 4 5 . stop 16 1 . >/dev/null
  74.     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  75.         invoke-rc.d hal start || exit $?
  76.     else
  77.         /etc/init.d/hal start || exit $?
  78.     fi
  79. fi
  80. # End automatically added section
  81.  
  82.  
  83. exit 0
  84.